package model

type person struct {
	Name string
	Age  int
}

// NewPerson is a function
func NewPerson(name string, age int) *person {
	return &person{
		Name: name,
		Age:  age,
	}
}

// 定义get set方法
func (p *person) SetName(name string) {
	p.Name = name
}

func (p *person) GetName() string {
	return p.Name
}

func (p *person) SetAge(age int) {
	// p.Age = age
	//0-150
	if age > 0 && age < 150 {
		p.Age = age
	} else {
		p.Age = 0
	}
}

func (p *person) GetAge() int {
	return p.Age
}
